package com.yuhao.hbasetest.dao;

import com.yuhao.hbasetest.entity.Demo;
import com.yuhao.hbasetest.hbase.HBaseDaoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 */
@Component("demoDao")
public class DemoDao {

    @Autowired
    private HBaseDaoUtil hBaseDaoUtil;

    /**
     * @Descripton:
     */
    public void save(Demo demo) {
        hBaseDaoUtil.save(demo);
    }

    /**
     * @Descripton:
     */
    public List<Demo> getById(Demo demo, String id) {
        return hBaseDaoUtil.get(demo, id);
    }

    /** 获取所有表 */
    public List<String> getAllTableName() {
        return hBaseDaoUtil.getAllTableNames();
    }

    /** 表名获取列簇 */
    public List<String> getFamilies(String tableName) {
        return hBaseDaoUtil.familys(tableName);
    }

    public Map<String, Map<String, String>> getResultScanner(String tableName) {
        return hBaseDaoUtil.getResultScanner(tableName);
    }
}
